import time

import HTMLTestRunner_PY3
from HTMLTestRunner_PY3 import HTMLTestRunner
import yagmail,logging


def Log():
    t=time.strftime('%Y%m%d%H%M%S',time.localtime())
    logging.basicConfig(filename='rizhi'+t+'.log',
                        filemode='w+',level=logging.DEBUG,
                        format='%(asctime)s %(filename)s %(levelname)s %(lineno)s %(message)s')


def Report():
    t = time.strftime('%Y%m%d%H%M%S', time.localtime())
    report=HTMLTestRunner_PY3.HTMLTestRunner(open('baogao'+t+'.html','wb'),title='这是A3mall测试报告')

    return report


def Email():
    t = time.strftime('%Y%m%d%H%M%S', time.localtime())
    email=yagmail.SMTP(user='1522057104@qq.com',password='mhszldzvffpnjfcc',host='smtp.qq.com',port=465)
    email.send(to='1522057104@qq.com',subject='这是A3mall测试邮件',contents=[['rizhi'+t+'.log'],['baogao'+t+'.loc']])